<!--
  文件描述：
  创建时间：2022/3/22 15:08
  创建人：Admin
-->
<template>
  <div class="action-sheet">
    <transition enter-active-class="animate__animated animate__slideInUp">
      <ul class="menu-list" v-if="flag">
        <li @click="itemClick(index)" v-for="(item,index) in actionSheetConfig.menuList" :key="index">{{item}}</li>
        <li @click="hideActionSheet">取消</li>
      </ul>
    </transition>
  </div>
</template>

<script>
export default {
  name: "action-sheet",
  data() {
    return {
      flag: false
    }
  }, mounted() {
    this.flag = true
  },
  methods: {
    itemClick(index) {
      if (this.actionSheetConfig.callBack && typeof this.actionSheetConfig.callBack == "function") {
        this.actionSheetConfig.callBack(index);
        this.hideActionSheet();
      }
    }
  }
}
</script>

<style scoped lang="scss">
.action-sheet {
  position: fixed;
  left: 0px;
  top: 0px;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 9999;

  .menu-list {
    width: 100%;
    position: absolute;
    left: 0px;
    bottom: 0px;

    li {
      background-color: white;
      height: 0.4rem;
      display: flex;
      justify-content: center;
      align-items: center;
      font-size: 0.14rem;
      font-weight: bold;

      &:not(:last-child) {
        border-bottom: 1px solid gray;
      }

      &:last-child {
        margin-top: 0.02rem;
      }
    }
  }
}
</style>